home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / RCSC.ZIP / LIB51 / UTOI.C < prev    next >
Text File  |  1997-01-12  |  361b  |  16 lines

  1. /*
  2. ** utoi -- convert unsigned decimal string to integer nbr
  3. **          returns field size, else ERR on error
  4. */
  5. utoi(decstr, nbr)  char *decstr;  int *nbr;  {
  6.   int d,t; d=0;
  7.   *nbr=0;
  8.   while((*decstr>='0')&(*decstr<='9')) {
  9.     t=*nbr;t=(10*t) + (*decstr++ - '0');
  10.     if ((t>=0)&(*nbr<0)) return ERR;
  11.     d++; *nbr=t;
  12.     }
  13.   return d;
  14.   }
  15.  
  16.